package behavior.iterator;
import java.util.List;

public class OutputImp {
    List<College> collegeList ;

    public OutputImp(List<College> collegeList) {
        this.collegeList = collegeList;
    }

    public void printCollege(){
        for(College college:collegeList){
            System.out.println("-----"+ college.getName() +"----");
            printDepartment(college.createIterator());
        }
    }
    //输出学院的系
    public void printDepartment(Iterator iterator){

        while (iterator.hasNext()){
            Department department = (Department) iterator.next();
            System.out.println(department.getName());
        }
    }
}
